#include<stdio.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
#define FIFO "./fifo"

int main()
{
	int fd = open(FIFO,O_WRONLY);
	if(fd < 0)
	{
		perror("open");
		return 1;
	}
	char buffer[128];
	while(1)
	{
		printf("Please Enter: ");
		fflush(stdout);
		buffer[0] = 0;
		ssize_t s = read(0,buffer,sizeof(buffer)-1);
		if(s > 0)
		{
			buffer[s] = 0;
			write(fd,buffer,strlen(buffer));
		}
		else
			break;
	}
	close(fd);
	return 0;
}
